package com.oocl.im.handler.impl;

import com.oocl.im.action.impl.SynAction;
import com.oocl.im.constants.ServerMap;
import com.oocl.im.entity.Client;
import com.oocl.im.entity.Protocol;
import com.oocl.im.handler.IHandle;

import java.io.ObjectOutputStream;
import java.util.*;

public class LogoutHandle implements IHandle{
	ObjectOutputStream oos;

	public LogoutHandle(ObjectOutputStream oos) {
		this.oos = oos;
	}

	@Override
	public void handle(Client client,Protocol protocol) {
		System.out.println("here is in logout handle");
		System.out.println("client is:"+client);
		System.out.println("logout handle client is: "+ client);
		ServerMap.clientMap.remove(client.getAccount());
		ServerMap.socketMap.remove(client);
		Map<String,Object> params=new HashMap<>();
		System.out.println("ServerMap.clientMap.keySet is: "+ServerMap.clientMap.keySet());
		List<String> list = new ArrayList<String>(ServerMap.clientMap.keySet());
		System.out.println("the list is:" + list);
		SynAction handle=new SynAction();
		handle.execute();
	}

	

}
